#ifndef MENU_H
#define MENU_H

#include <QMainWindow>
#include "game.h"
#include "encounter.h"

QT_BEGIN_NAMESPACE
namespace Ui { class Menu; }
QT_END_NAMESPACE

class Menu : public QMainWindow
{
    Q_OBJECT

public:
    Menu(QWidget *parent = nullptr);
    ~Menu();

private:
    Ui::Menu *ui;
    game *g;
    QPoint offset;//存储鼠标与label位置差值
    int lastcellx=-1,lastcelly=-1;//存储鼠标移动事件中上一个细胞位置
    int startcellx=-1,startcelly=-1;//存储即将改变的矩形起点
    bool startcell=false;

protected:
    void paintEvent(QPaintEvent *event);
    void timerUpdate();

private slots:
    void on_gamepushButton_clicked();
    void on_storypushButton_clicked();
    void on_continuepushButton_clicked();
    void on_renewpushButton_clicked();
};

class map1
{
private:
    int neighbor[1000][1000];//邻居细胞个数
    int width=15; //细胞大小
    int height=15;
    int widthnum=48; //细胞  c个数
    int heightnum=48;

public:
    int map11[1000][1000];//存活状态 1为存活
    map1();
    ~map1(){};
    int getwidth(){return width;};
    int getheight(){return height;};
    int getwidthnum(){return widthnum;};
    int getheightnum(){return heightnum;};
    void changemap(int x,int y){map11[x][y]^=1;};//异或运算
    int getmap(int x,int y){return map11[x][y];};
    void mapupdate();
    void mapclear();
};

#endif // MENU_H
